package com.amado.course42Socket.udp;

/*
*发送端
*/
import java.net.*;
class  Client
{
	public static void main(String[] args) throws Exception
	{
		//通过DatagramSocket对象创建UDP服务
		DatagramSocket ds = new DatagramSocket();
		//确定数据，并封装成数据包。DatagramPacket(byte[] buf, int length, InetAddress address, int port)
		byte [] b = "ds dd df".getBytes();
		DatagramPacket dp = new DatagramPacket(b,b.length,InetAddress.getByName( "localhost"),10000);
		//通过Socket服务，通过Send方法将数据包发送出去
		ds.send(dp);
		//关闭资源
		ds.close();
	}
}
